var blank = new Image();
blank.src = 'Images/blank.html';

$(document).ready(function() {
    runFix();
    runEffect();
});
function runFix() {
    var badBrowser = (/MSIE ((5\.5)|6)/.test(navigator.userAgent) && navigator.platform == "Win32");
    if (badBrowser) {
        // get all pngs on page
        $('img[src$=.png]').each(function() {
            if (!this.complete) {
                this.onload = function() { fixPng(this) };
            } else {
                fixPng(this);
            }
        });
    }
}
function fixPng(png) {
    // get src
    var src = png.src;
    // set width and height
    if (!png.style.width) { png.style.width = $(png).width(); }
    if (!png.style.height) { png.style.height = $(png).height(); }
    // replace by blank image
    png.onload = function() { };
    png.src = blank.src;
    // set filter (display original image)
    png.runtimeStyle.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + src + "',sizingMethod='scale')";
}

function runEffect() {
    if ($('.i_ttt').length) {
        $('.i_ttt').eduHover({
            widthOld: 150,
            heightOld: 145,
            widthNew: 201,
            heightNew: 194,
            top: 30,
            left: 456,
            topDefalt: 70,
            leftDefault: 486,
            imgHover: 'Images/Home/thitructuyen_large.png'
        });
    }
    if ($('.i_etc').length) {
        $('.i_etc').eduHover({
            widthOld: 150,
            heightOld: 115,
            widthNew: 223,
            heightNew: 171,
            top: 340,
            left: 100,
            topDefalt: 370,
            leftDefault: 130,

            imgHover: 'Images/Home/e_tapchi_large.png'
        });
    }
    if ($('.i_tv').length) {
        $('.i_tv').eduHover({
            widthOld: 150,
            heightOld: 117,
            widthNew: 220,
            heightNew: 171,
            top: 347,
            left: 680,
            topDefalt: 377,
            leftDefault: 700,
            imgHover: 'Images/Home/Thuvien_large.png'
        });
    }
    if ($('.i_tgd').length) {
        $('.i_tgd').eduHover({
            widthOld: 150,
            heightOld: 143,
            widthNew: 201,
            heightNew: 192,
            top: 192,
            left: 642,
            topDefalt: 212,
            leftDefault: 662,
            imgHover: 'Images/Home/tingiaoduc_large.png'
        });
    }
    if ($('.i_htt').length) {
        $('.i_htt').eduHover({
            widthOld: 150,
            heightOld: 145,
            widthNew: 201,
            heightNew: 194,
            top: 49,
            left: 264,
            topDefalt: 65,
            leftDefault: 294,
            imgHover: 'Images/Home/hoctructuyen_large.png'
        });
    }
    if ($('.i_thgd').length) {
        $('.i_thgd').eduHover({
            widthOld: 160,
            heightOld: 120,
            widthNew: 250,
            heightNew: 175,
            top: 200,
            left: 140,
            topDefalt: 230,
            leftDefault: 170,
            imgHover: 'Images/Home/thgd_large.png'
        });
    }

}